package com.kiki.stater;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/**
 * Created by mazeyi on 2020/10/30.
 */
public class CpuTest {

    public static void main(String[] args) {
        CountDownLatch latch = new CountDownLatch(4);

        for(int i=0; i < 10; i++){
            new Thread(() -> {
                latch.countDown();
                try {
                    TimeUnit.SECONDS.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName());
            }).start();
        }


        try {
            latch.await();
            new Thread(() -> {
                System.out.println("空闲出资源供我使用1111");
            }).start();
        } catch (InterruptedException e) {

        }


    }
}